package com.nbsaas.boot.scm.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "供应商评估", model = "供应商评估")
@Entity
@Table(name = "bs_supplier_evaluation")
@Comment("供应商评估表")
public class SupplierEvaluation extends AbstractEntity {

    @Comment("评估编号")
    @SearchItem(name = "evaluationNo", key = "evaluationNo", label = "评估编号")
    @FormField(title = "评估编号", sortNum = "1", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String evaluationNo;

    @Comment("评估标题")
    @SearchItem(name = "title", key = "title", label = "评估标题")
    @FormField(title = "评估标题", sortNum = "2", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String title;

    @Comment("供应商ID")
    @FormField(title = "供应商", sortNum = "3", grid = true, type = InputType.select, required = true)
    private Long supplierId;

    @Comment("供应商编码")
    @FormField(title = "供应商编码", sortNum = "4", grid = true)
    @Column(length = 50)
    private String supplierCode;

    @Comment("供应商名称")
    @FormField(title = "供应商名称", sortNum = "5", grid = true)
    @Column(length = 200)
    private String supplierName;

    @Comment("评估类型")
    @FormField(title = "评估类型", sortNum = "6", grid = true, type = InputType.select)
    @Column(length = 50)
    private String evaluationType; // INITIAL-初始评估, PERIODIC-定期评估, SPECIAL-专项评估, RENEWAL-续期评估

    @Comment("评估周期")
    @FormField(title = "评估周期", sortNum = "7", grid = true, type = InputType.select)
    @Column(length = 20)
    private String evaluationPeriod; // QUARTERLY-季度, SEMI_ANNUAL-半年, ANNUAL-年度, SPECIAL-专项

    @Comment("评估状态")
    @FormField(title = "评估状态", sortNum = "8", grid = true, type = InputType.select)
    @Column(length = 20)
    private String evaluationStatus; // DRAFT-草稿, IN_PROGRESS-评估中, COMPLETED-已完成, APPROVED-已审批

    @Comment("评估开始日期")
    @FormField(title = "评估开始日期", sortNum = "9", type = InputType.date, grid = true)
    private Date evaluationStartDate;

    @Comment("评估结束日期")
    @FormField(title = "评估结束日期", sortNum = "10", type = InputType.date, grid = true)
    private Date evaluationEndDate;

    @Comment("评估人ID")
    @FormField(title = "评估人", sortNum = "11", grid = true, type = InputType.select)
    private Long evaluatorId;

    @Comment("评估人姓名")
    @FormField(title = "评估人姓名", sortNum = "12", grid = true)
    @Column(length = 100)
    private String evaluatorName;

    @Comment("质量评分")
    @FormField(title = "质量评分", sortNum = "13", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal qualityScore;

    @Comment("交付评分")
    @FormField(title = "交付评分", sortNum = "14", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal deliveryScore;

    @Comment("价格评分")
    @FormField(title = "价格评分", sortNum = "15", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal priceScore;

    @Comment("服务评分")
    @FormField(title = "服务评分", sortNum = "16", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal serviceScore;

    @Comment("技术评分")
    @FormField(title = "技术评分", sortNum = "17", grid = true, type = InputType.el_input_number)
    @Column(precision = 5, scale = 2)
    private BigDecimal technicalScore;

    @Comment("综合评分")
    @FormField(title = "综合评分", sortNum = "18", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 5, scale = 2)
    private BigDecimal overallScore;

    @Comment("评估等级")
    @FormField(title = "评估等级", sortNum = "19", grid = true, type = InputType.select)
    @Column(length = 20)
    private String evaluationLevel; // A-优秀, B-良好, C-一般, D-较差, E-不合格

    @Comment("评估结论")
    @FormField(title = "评估结论", sortNum = "20", type = InputType.select)
    @Column(length = 50)
    private String evaluationConclusion; // QUALIFIED-合格, CONDITIONAL_QUALIFIED-有条件合格, DISQUALIFIED-不合格

    @Comment("质量评价")
    @FormField(title = "质量评价", sortNum = "21", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String qualityEvaluation;

    @Comment("交付评价")
    @FormField(title = "交付评价", sortNum = "22", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String deliveryEvaluation;

    @Comment("价格评价")
    @FormField(title = "价格评价", sortNum = "23", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String priceEvaluation;

    @Comment("服务评价")
    @FormField(title = "服务评价", sortNum = "24", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String serviceEvaluation;

    @Comment("技术评价")
    @FormField(title = "技术评价", sortNum = "25", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String technicalEvaluation;

    @Comment("改进建议")
    @FormField(title = "改进建议", sortNum = "26", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String improvementSuggestions;

    @Comment("评估报告")
    @FormField(title = "评估报告", sortNum = "27", type = InputType.image)
    @Column(length = 500)
    private String evaluationReport;

    @Comment("审批意见")
    @FormField(title = "审批意见", sortNum = "28", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String approvalComment;

    @Comment("审批人ID")
    @FormField(title = "审批人", sortNum = "29", grid = true, type = InputType.select)
    private Long approverId;

    @Comment("审批人姓名")
    @FormField(title = "审批人姓名", sortNum = "30", grid = true)
    @Column(length = 100)
    private String approverName;

    @Comment("审批时间")
    @FormField(title = "审批时间", sortNum = "31", type = InputType.date, grid = true)
    private Date approvalTime;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "32", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String remark;
} 